local skel = fk.CreateSkill {
  name = "efengqi__tishen",
  tags = {Skill.Limited},
}

Fk:loadTranslationTable{
  ["efengqi__tishen"] = "替身",
  [":efengqi__tishen"] = "限定技，准备阶段，若你已受伤，则你可以将体力值回复至上限，然后摸回复数值张牌。",
  ["#efengqi__tishen-invoke"] = "替身: 你可以回复 %arg 点体力并摸 %arg 张牌",

  ["$efengqi__tishen1"] = "欺我无谋，定要尔等血偿！",
  ["$efengqi__tishen2"] = "谁，还敢过来一战！？",
}

skel:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Start and player:isWounded() and
      player:usedSkillTimes(self.name, Player.HistoryGame) == 0
  end,
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, { skill_name = skel.name, prompt = "#efengqi__tishen-invoke:::"..player:getLostHp()})
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local n = player:getLostHp()
    room:recover({
      who = player,
      num = n,
      recoverBy = player,
      skillName = self.name
    })
    if not player.dead then
      player:drawCards(n, self.name)
    end
  end,
})

return skel
